"use strict";
import axios from "axios";
// http://182.61.15.30:8400/
// http://192.168.2.148:8400 本地
// https://www.smartptm.com/ptm
const service = axios.create({
    baseURL: process.env.NODE_ENV === 'production' ? location.origin + '/ptm/' : 'https://www.smartptm.com/ptm',
    timeout: 10000,
	// withCredentials:true
});
// request拦截器
service.interceptors.request.use(config => {
    // console.log(config,"config");
  // let token=true;
  // if(token){
  //   config.headers['X-token']='123';
  // }
    return config;
}, error => {
    return Promise.reject(error);
});

// response拦截器
service.interceptors.response.use(response => {
    const res = response.data;
    // if(res.statusCode !== 200){
    //     message(res.statusMsg,3000)
    // }
    return response.data;
}, error => {
    let showMsg = error.statusMsg;
    // if (!error.statusMsg) {
    //   showMsg = '网络超时，请稍后再试'
    // }
    // hiddenLoading();
    // message(showMsg,3000);
    return Promise.reject(error);
});
export default service
